package com.zsj.service_oss.util;

import lombok.Data;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;


@Component
@Data
public class OssPropertiesUtils implements InitializingBean {

    //读取配置文件中的属性
    @Value("${aliyun.oss.file.endpoint}")
    private  String endpoint;

    @Value("${aliyun.oss.file.keyid}")
    private  String keyid;

    @Value("${aliyun.oss.file.keysecret}")
    private  String keysecret;

    @Value("${aliyun.oss.file.bucketname}")
    private  String bucketname;



    public static  String END_POINT;
    public static  String KEY_ID;
    public static  String KEY_SECRET;
    public static  String BUCKET_NAME;


    //在项目初始化的时候执行
    @Override
    public void afterPropertiesSet() throws Exception {
        END_POINT = endpoint;
        KEY_ID = keyid;
        KEY_SECRET = keysecret;
        BUCKET_NAME = bucketname;
    }


}
